package conexao;

import java.rmi.AlreadyBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

import serventes.ServidorServente;

public class Servidor {
	int porta;

	public Servidor(int porta) {
		
		this.porta = porta;
	}

	public void iniciaServidor() throws RemoteException, AlreadyBoundException {

		Registry registry = LocateRegistry.createRegistry(porta);

		final ServidorServente ss = new ServidorServente();
		registry.bind("Servidor", ss);
		
		System.out.println("Servidor started in port:" + porta);
	}
}
